package com.ease.component.events {
   import com.ease.component.controls.TabButton;

   import flash.events.Event;

   /**
    * Event containing specific properties for tab
    * controls that can have temporary state.
    * They contain information about the index and a reference
    * to the <code>TabButton</code> that fired them.
    */
   public class TabNavigationEvent extends Event {
      public var tabIndex:Number;
      public var tabButton:TabButton;

      /**
      * TabCreation event string
      */
      public static const CREATE_TAB:String = "createTab";

      /**
      * TabClosed event string
      */
      public static const CLOSE_TAB:String ="closeTab";

      /**
       * TabClosed event string
       */
      public static const CLOSE_TAB_FINISHED:String ="closeTabFinished";

      /**
       * The add tab clicked
       */
      public static const ADD_TAB:String ="AddTab";

      /**
      * Tab Navigation event constructor
      * @param: index - the index of the tab that spawned the event
      * @param: temporary - if the tab was a temporary tab or not
      */
      public function TabNavigationEvent(type:String, index:Number = -1, bubbles:Boolean=false, cancelable:Boolean=true) {
         super(type, bubbles, cancelable);
         this.tabIndex = index;
      }

      public override function clone():Event {
         var tabNavEvent:TabNavigationEvent = new TabNavigationEvent(type, tabIndex, bubbles, cancelable);
         tabNavEvent.tabButton = tabButton;
         return tabNavEvent;
      }
   }
}
